<?php
/**
 * Created by PhpStorm.
 * User: liandne
 * Date: 2016/12/12
 * Time: 上午11:12
 */
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * App\Orders
 *
 * @property integer $id 标识
 * @property integer $user_id 关联用户id
 * @property integer $doctor_id 医生id
 * @property integer $package_id 套餐id
 * @property string $order_num 订单编号(预约号)
 * @property float $order_price 订单金额
 * @property integer $ispay 是否支付
 * @property string $pay_time 支付时间
 * @property integer $status 订单状态
 * @property string $patient_name 患者姓名
 * @property string $patient_phone 患者联系电话
 * @property string $patient_birth 患者生日
 * @property string $type 预定类型
 * @property string $deleted_at
 * @property \Carbon\Carbon $created_at
 * @property \Carbon\Carbon $updated_at
 * @property-read \App\User $user
 * @property-read \App\Packages $package
 * @property-read \App\Doctors $doctor
 * @method static \Illuminate\Database\Query\Builder|\App\Orders whereId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Orders whereUserId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Orders whereDoctorId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Orders wherePackageId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Orders whereOrderNum($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Orders whereOrderPrice($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Orders whereIspay($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Orders wherePayTime($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Orders whereStatus($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Orders wherePatientName($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Orders wherePatientPhone($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Orders wherePatientBirth($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Orders whereType($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Orders whereDeletedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Orders whereCreatedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Orders whereUpdatedAt($value)
 * @mixin \Eloquent
 * @property string $bespoke_time 预约日期
 * @method static \Illuminate\Database\Query\Builder|\App\Orders whereBespokeTime($value)
 * @property integer $bespoke_slot 挂号预约时间段
 * @method static \Illuminate\Database\Query\Builder|\App\Orders whereBespokeSlot($value)
 * @property int $hospital_id 医院id
 * @method static \Illuminate\Database\Query\Builder|\App\Orders whereHospitalId($value)
 */
class Orders extends Model {

    protected $table = 'orders';
    use SoftDeletes;


    /**
     * 用户表关联
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function user(){
        return $this->belongsTo('App\User','user_id');
    }

    /**
     * 顾问套餐表关联
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function package(){
        return $this->belongsTo('App\Packages','package_id');
    }

    /**
     * 医生表关联
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function doctor(){
        return $this->belongsTo('App\Doctors','doctor_id');
    }
}
